#pragma once

#include "tiny_tls.h"

class RT_API_EXPORT CMCDB
{
public:
	CMCDB();
	virtual ~CMCDB();
	static CMCDB* Instance();

public:
	RtResult Init(const string& strIp, unsigned short nPort);
	HANDLE	GetHandler();
	RtResult get_string(const string& strKey, string& strValue);
	RtResult set_string(const string& strKey, const string& strValue, int nExpiration = 3600*24*30);
	RtResult del_string(const string& strKey);

protected:
	HANDLE OpenDB();
	void CloseDB(HANDLE hDB);

private:
	string m_strIp;
	unsigned short m_nPort;
	CTinyTLS	m_tls;
};






